﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace EmployeeCheckIn
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
             
       
        StringBuilder sb = new StringBuilder();
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Session["User"] == null && Session["Pass"] == null)
            {
                
                //NavigationMenu.Visible = false;  
            }
        }

    

        protected void LinkButton1_Click1(object sender, EventArgs e)
        {
            //ถ้าเลือก หน้า HOME
            if (Session["User"] != null && Session["Pass"] != null)
            {
                Server.Transfer("MenuAdmin.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }

        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            if (Session["User"] != null && Session["Pass"] != null)
            {
                //ไปหน้าซันนี่
                Server.Transfer("ShowList_Empoyee.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }

        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            //ถ้าเลือก หน้า admin
            if (Session["User"] != null && Session["Pass"] != null)
            {
                //ไปหน้า admin
                Server.Transfer("ShowTime_Empoyee.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            //ถ้าเลือก หน้า admin
            if (Session["User"] != null && Session["Pass"] != null)
            {
                //ไปหน้า admin
                Server.Transfer("Edittimetostart.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
        protected void LinkButton5_Click(object sender, EventArgs e)
        {
            //ถ้าเลือก หน้า admin
            if (Session["User"] != null && Session["Pass"] != null)
            {
                //ไปหน้า admin
                Server.Transfer("EditAdmin.aspx");
            }
            else
            {
                Response.Redirect("Default.aspx");
            }
        }
        protected void LinkButton6_Click(object sender, EventArgs e)
        {
             
                     
                    //ถ้าเลือก หน้า admin
                     if (Session["User"] != null && Session["Pass"] != null)
                     {
                         string status = Session["status"].ToString();
                         if (status=="1")
                         {
                           //ไปหน้า admin
                            Server.Transfer("ListAdmin.aspx");  
                         }
                         if (status=="2")
                         {
                             sb.Append("<script language='javascript' type = 'text/javascript'>");
                             sb.Append("alert('สถานะของคุณไม่สามารถใช้งานได้')");
                             sb.Append("</script>");
                             Response.Write(sb.ToString());

                         }

                     }
                    else
                    {
                        Response.Redirect("Default.aspx");
                    }
        }
         protected void LinkButton7_Click(object sender, EventArgs e)
        {
                                             //ถ้าเลือก หน้า ออกจากระบบ
                    Session["JavaCheckLog"] = "";
                    Session["JavaCeateAdmin"] = "";
                    Session["User"] = "";
                    Session["Pass"] = "";
                    Session.Abandon();
                    Session.Clear();
                    Session.Contents.RemoveAll();
                    System.Web.Security.FormsAuthentication.SignOut();
                    Response.Redirect("Default.aspx");

        }
         protected void LinkButton8_Click(object sender, EventArgs e)
         {
         }  

       } 
     }

     
      
    

